//
////



#ifndef GETPHOTOBYWEBADDR_H
#define GETPHOTOBYWEBADDR_H
#pragma comment(lib, "ws2_32.lib")
#include <winsock2.h>
#include <string>
#include <fstream>
#include <iostream>
#include "../Header/WebEffectServer.h"

using std::string;

class GetPhotoByWebAddr
{

public:
	GetPhotoByWebAddr();
	GetPhotoByWebAddr(string &);
	bool CreateSocket();
	bool GetPhoto();
	bool GetPhoto(string &);
	bool GetUrl();
	void SendReq();
	bool RecvData();
	void FreeRes();
	unsigned int GetPhotoSize();
	int	AnswerEffect();
	void SetUrl(const string &, const string &);
	bool GetDirect();
	bool GetByProxy();
	void WriteServerFile();
	void SendProxyReq();
		
private:
	WebEffectServer web_server;
	string 		src;
	SOCKET 		sock;
	WSADATA 	wsa_data;
	string 		str_port_num;
	string		str_web_addr;
	string		str_file_name;
	string		str_outphoto_name;
	struct hostent*		host_name;		
	struct sockaddr_in	server_addr;
	unsigned int recv_num_sum;
	unsigned int photo_file_size;

};



#endif
